namespace = xit_operation

espionage_operation_event = {
	id = xit_operation.1
	title = xit_operation.1.name
	desc = xit_operation.1.desc
	espionage_operation = yes
	picture = GFX_xit_event_dormant_ovomorph_signatures
	show_sound = xit_galactic_infestation_quiet
	is_triggered_only = yes

	option = {
		name = ACKNOWLEDGED
	}
}

espionage_operation_event = {
	id = xit_operation.2
	title = xit_operation.2.name
	desc = xit_operation.2.desc
	espionage_operation = yes
	picture = GFX_xit_event_subsurface_ovomorph_cache
	show_sound = xit_galactic_infestation_quiet
	is_triggered_only = yes

	option = {
		name = ACKNOWLEDGED
	}
}

espionage_operation_event = {
	id = xit_operation.3
	title = xit_operation.3.name
	desc = xit_operation.3.desc
	espionage_operation = yes
	picture = GFX_xit_event_dormant_ovomorph_signatures
	show_sound = xit_galactic_infestation_quiet
	is_triggered_only = yes

	immediate = {
		set_espionage_operation_progress_locked = yes
	}

	option = {
		trigger = {
			target = {
				any_owned_planet = {
					is_colony = yes
					is_capital = no
					NOT = { has_deposit = d_xit_dormant_ovomorph_cluster }
					NOT = { has_modifier = xit_xenomorph_infestation }
					NOT = { has_modifier = xit_xenomorph_outbreak }
					NOT = { has_modifier = xit_xenomorph_overrun }
					NOT = { has_modifier = xit_xenomorph_terminal_collapse }
				}
			}
		}
		name = LAUNCH_OPERATION
		custom_tooltip = operation_xit_seed_ovomorph_vector_result_tooltip
		hidden_effect = {
			target = {
				set_timed_country_flag = {
					flag = xit_seed_ovomorph_vector_recent@root.owner
					days = 3600
				}
				random_owned_planet = {
					limit = {
						is_colony = yes
						is_capital = no
						NOT = { has_deposit = d_xit_dormant_ovomorph_cluster }
						NOT = { has_modifier = xit_xenomorph_infestation }
						NOT = { has_modifier = xit_xenomorph_outbreak }
						NOT = { has_modifier = xit_xenomorph_overrun }
						NOT = { has_modifier = xit_xenomorph_terminal_collapse }
					}
					save_event_target_as = xit_operation_seed_planet
					add_deposit = d_xit_dormant_ovomorph_cluster
					if = {
						limit = {
							root.owner = {
								has_technology = tech_xit_brood_host_selection
							}
						}
						set_timed_carrier_flag = { flag = xit_brood_host_selection_pressure days = 3600 }
					}
					if = {
						limit = {
							root.owner = {
								has_technology = tech_xit_xenomorph_biocontainment_subversion
							}
						}
						set_timed_carrier_flag = { flag = xit_biocontainment_subversion_pressure days = 3600 }
					}
					if = {
						limit = {
							root.owner = {
								has_technology = tech_xit_macro_ovomorph_seeding
							}
						}
						set_timed_carrier_flag = { flag = xit_macro_ovomorph_seeding_pressure days = 3600 }
					}
					if = {
						limit = {
							root.owner = {
								has_technology = tech_xit_macro_ovomorph_seeding
							}
							owner = { xit_biosecurity_science_tier_3 = yes }
						}
						random_list = {
							5 = {
								add_modifier = { modifier = xit_xenomorph_infestation days = 720 }
								xit_create_hidden_xenomorph_seed_pop = yes
							}
							95 = { }
						}
					}
					else_if = {
						limit = {
							root.owner = {
								has_technology = tech_xit_macro_ovomorph_seeding
							}
							owner = { xit_biosecurity_science_tier_2 = yes }
						}
						random_list = {
							10 = {
								add_modifier = { modifier = xit_xenomorph_infestation days = 720 }
								xit_create_hidden_xenomorph_seed_pop = yes
							}
							90 = { }
						}
					}
					else_if = {
						limit = {
							root.owner = {
								has_technology = tech_xit_macro_ovomorph_seeding
							}
							owner = { xit_biosecurity_science_tier_1 = yes }
						}
						random_list = {
							20 = {
								add_modifier = { modifier = xit_xenomorph_infestation days = 720 }
								xit_create_hidden_xenomorph_seed_pop = yes
							}
							80 = { }
						}
					}
					else_if = {
						limit = {
							root.owner = {
								has_technology = tech_xit_macro_ovomorph_seeding
							}
						}
						random_list = {
							35 = {
								add_modifier = { modifier = xit_xenomorph_infestation days = 720 }
								xit_create_hidden_xenomorph_seed_pop = yes
							}
							65 = { }
						}
					}
					else_if = {
						limit = {
							root.owner = {
								is_xenomorph_empire = yes
							}
						}
						set_timed_carrier_flag = { flag = xit_stalker_caste_pressure days = 3600 }
						random_list = {
							25 = {
								add_modifier = { modifier = xit_xenomorph_infestation days = 720 }
								xit_create_hidden_xenomorph_seed_pop = yes
							}
							75 = { }
						}
					}
					else_if = {
						limit = {
							root.owner = {
								is_xenomorph_empire = yes
							}
						}
						random_list = {
							15 = {
								add_modifier = { modifier = xit_xenomorph_infestation days = 720 }
								xit_create_hidden_xenomorph_seed_pop = yes
							}
							85 = { }
						}
					}
				}
			}
			owner = {
				country_event = { id = xit_operation.10 days = 1 }
			}
		}
	}

	option = {
		trigger = {
			target = {
				NOT = {
					any_owned_planet = {
						is_colony = yes
						is_capital = no
						NOT = { has_deposit = d_xit_dormant_ovomorph_cluster }
						NOT = { has_modifier = xit_xenomorph_infestation }
						NOT = { has_modifier = xit_xenomorph_outbreak }
						NOT = { has_modifier = xit_xenomorph_overrun }
						NOT = { has_modifier = xit_xenomorph_terminal_collapse }
					}
				}
			}
		}
		name = operation_xit_seed_ovomorph_vector_no_colony_option
	}

	after = {
		set_espionage_operation_progress_locked = no
	}
}

country_event = {
	id = xit_operation.10
	title = xit_operation.10.name
	desc = xit_operation.10.desc
	picture = GFX_xit_event_dormant_ovomorph_signatures
	show_sound = xit_galactic_infestation_quiet
	is_triggered_only = yes

	option = {
		name = xit_operation.10.a
	}
}
